/**
 * package com.synnex.arch.demo.jsf2
 * class com.synnex.arch.demo.jsf2.HelloBean
 * Created on 18/05/2012, 10:47:55 AM 
 * @author diegol
 */
package com.synnex.arch.demo.jsf2;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * <b>Description</b>: In JSF 1.x, you had to declare this beans in the faces-config.xml, but this is no longer required in JSF 2.0.
 * <p><b>Features or change log:</b>
 * <ol>
 * <li>18/03/2012 10:47:55 AM, Tonyq, C001: xxx xx xcxv </li>
 * <li>18/05/2012 10:47:55 AM, diegol, C002: xxxx xxcxv </li>
 * <li></li>
 * </ol>
 */
@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {
    private static final long serialVersionUID = -4016816822326033489L;

    /**
     * <b>Usage:</b>
     * <ul><li>if (LOG.isDebugEnabled()) LOG.debug("latestVer @ {}: {}",artiDir,latestVer);</li>
     * <li>LOG.error("{} is NOT valid in form!",version);</li>
     * <li>LOG.error("ERROR! ", e);</li></ul>
     */
    private static final Logger LOG = LoggerFactory.getLogger(HelloBean.class);

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if (LOG.isInfoEnabled()) {
            LOG.info("!!! Name is {}.",name);
        }
        this.name = name;/* C001, asdfxz.xzcv */
    }
    public static void main(String[] args) {
        int i = 1;
        i = i++;
        System.out.println(i);
    }

/**
 * Parse the String of <code>message to get the</code> application name to get relevant parser.
 * <p>The messages sent by log4j all start with an application name, like mycis-us-prod, and its facility is -1, relevant string 'UNKNOWN'.
 * <p>Messages sent by other resource, have to use ip-facility-app mapping to judge its application name.<br />
 * Therefore, Implementation:<br />
 * if use the mapping, then get the facility string, if the facility belongs to those defined by syslogspec.,
 * then look up the mapping to get the application name.<br />
 * Otherwise, try to get the name from message.
 * <p>The value retrieved by event.getFacility() is ONLY the part of "<<", like 21 of "21<<3". Apacheand log4j checked.<br />
 * Therefore, get the facility string, must use:<br />
 * <b>String facility = SyslogUtility.getFacilityString(event.getFacility()<<3);</b>
 * org.productivity.java.syslog4j.SyslogConstants defines:<br />
 * public static final int FACILITY_LOCAL0   = 16<<3;<br />
 * public static final int FACILITY_LOCAL1   = 17<<3;<br />
 * public static final int FACILITY_LOCAL2   = 18<<3;<br />
 * public static final int FACILITY_LOCAL3   = 19<<3;<br />
 * public static final int FACILITY_LOCAL4   = 20<<3;<br />
 * public static final int FACILITY_LOCAL5   = 21<<3;<br />
 * public static final int FACILITY_LOCAL6   = 22<<3;<br />
 * public static final int FACILITY_LOCAL7   = 23<<3;<br />
 * @param message The original raw message.
 * @return Might be null, need to judge.
 * @throws LogException When capture this excetion, stop the process of parse the message.
 */
    public String parseApplicationName(String message) throws LogException {
        return null;
    }
}

class LogException extends Exception {
    private static final long serialVersionUID = 3717691137076432588L;
}
/*
 * Note In JSF 1.x, you had to declare the “navigation rule” in “faces-config.xml“, to tell which page to display when the button is
 * clicked. In JSF 2.0, you can put the page name directly in the button’s “action” attribute. For simple navigation, it’s more than enough,
 * but, for complex navigation, you are still advise to use the “navigation rule” in “faces-config.xml“.
 */
